package com.xuhai.blog.api;

import com.xuhai.blog.admin.service.BannerService;
import com.xuhai.blog.admin.service.WebsiteService;
import com.xuhai.blog.common.util.ResultJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author PangJunjie
 * @Date 2022/2/15/015
 */
@RestController
@RequestMapping("/api")
public class ApiIndexController {

    @Autowired
    private WebsiteService websiteService;

    @Autowired
    private BannerService bannerService;


    @GetMapping("/website")
    public ResultJson website(){
        return ResultJson.ok().data(websiteService.getById(1));
    }

    @GetMapping("/banner")
    public ResultJson banner(){
        return ResultJson.ok().data(bannerService.getBannerList());
    }

    @GetMapping("/href")
    public ResultJson href(){
        return ResultJson.ok().data(bannerService.getHrefList());
    }
}
